{% extends "base_generic.html" %}

{% block content %}
<div class="container mt-4">
    <div class="card">
        <div class="card-header bg-primary text-white">
            <h1 class="mb-0"><i class="fas fa-book"></i> 书籍副本: {{ bookinstance.book.title }}</h1>
        </div>
        <div class="card-body">
            {% if perms.catalog.change_bookinstance or perms.catalog.delete_bookinstance %}
            <div class="mb-4">
                {% if perms.catalog.change_bookinstance %}
                    <a href="{% url 'bookinstance-update' bookinstance.id %}" class="btn btn-primary"><i class="fas fa-edit"></i> 更新书籍副本</a>
                {% endif %}
                {% if perms.catalog.delete_bookinstance %}
                    <a href="{% url 'bookinstance-delete' bookinstance.id %}" class="btn btn-danger ms-2"><i class="fas fa-trash"></i> 删除书籍副本</a>
                {% endif %}
            </div>
            {% endif %}
            
            <p><i class="fas fa-user-edit"></i> <strong>作者:</strong> <a href="{{ bookinstance.book.author.get_absolute_url }}">{{ bookinstance.book.author }}</a></p>
            <p><i class="fas fa-info-circle"></i> <strong>版本信息:</strong> {{ bookinstance.imprint }}</p>
            <p class="{% if bookinstance.status == 'a' %}text-success{% elif bookinstance.status == 'd' %}text-danger{% else %}text-warning{% endif %}">
                <i class="fas fa-circle"></i> <strong>状态:</strong> {{ bookinstance.get_status_display }} 
                {% if bookinstance.status != 'a' %} (应归还日期: {{bookinstance.due_back}}){% endif %}
            </p>
            
            <div class="mt-4">
                <a href="{{ bookinstance.book.get_absolute_url }}" class="btn btn-secondary"><i class="fas fa-list"></i> 所有副本</a>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block sidebar %}
  {{ block.super }}
{% endblock %}